package com.dbms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.dbms.common.annotation.DataSource;
import com.dbms.common.enums.DataSourceType;
import com.dbms.domain.entity.StRiverR;
import com.dbms.mapper.StRiverRMapper;
import com.dbms.service.StRiverRService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
@Slf4j
public class StRiverRServiceImpl implements StRiverRService {

    final StRiverRMapper mapper;

    @Override
    @DataSource(DataSourceType.SQLSERVER)
    public StRiverR queryByTMAndStcd(String tm, String stcd) {
        return mapper.selectOne(new LambdaQueryWrapper<StRiverR>()
                .eq(StRiverR::getTm,tm)
                .eq(StRiverR::getStcd,stcd)
        );
    }

    @Override
    @DataSource(DataSourceType.SQLSERVER)
    public List<StRiverR> queryAll() {
        return mapper.selectList(new LambdaQueryWrapper<>());
    }
}
